<template>
	<view class="a">
	
		<!-- 	<template name="tpl_list">
			<view class="fui-goods-item">
				<navigator
					hoverClass="none"
					openType="navigate"
					:url="item.bargain > 0 ? '../../../bargain/detail/detail?id=' + item.bargain : '/pages/goods/detail/index?id=' + item.id"
				>
					<view class="image" :style="'background-image:url(' + item.thumb + ')'"></view>
					<image class="salez" :src="item.saleout" v-if="(item.saleout && item.cansee <= 0) || (item.saleout && item.cansee > 0 && item.seecommission <= 0)"></image>
					<view class="goods-Commission" v-if="item.cansee > 0 && item.seecommission > 0">{{ item.seetitle }}￥{{ item.seecommission }}</view>
				</navigator>
				<view class="detail goods_list_detail">
					<navigator
						hoverClass="none"
						openType="navigate"
						:url="item.bargain > 0 ? '../../../bargain/detail/detail?id=' + item.bargain : '/pages/goods/detail/index?id=' + item.id"
					>
						<view class="name">
							<text class="cycle-tip" v-if="item.type == 9">周期购</text>
							<text class="cycle-tip" v-if="item.bargain > 0">砍价</text>
							<text>{{ item.title }}</text>
						</view>
					</navigator>
					<view class="original_price">
						<text v-if="item.productprice > 0">¥{{ item.productprice }}</text>
					</view>
					<view class="price">
						<view class="text">¥{{ item.minprice }}</view>
						<view @tap="selectPicker" data-buytype="buy" data-home="1" :data-id="item.id" v-if="item.type != 9 && item.type != 5 && item.bargain == 0">
							<text class="buy icox icox-gouwuche buybtnbtn buybtn-5" style="color:#ff5555"></text>
						</view>
						<navigator class="buy buybtnbtn buybtn-1" style :url="'/pages/goods/detail/index?id=' + item.id" v-if="item.type == 9 && item.bargain == 0">详情</navigator>
						<navigator class="buy buybtnbtn buybtn-1" style :url="'/pages/goods/detail/index?id=' + item.id" v-if="item.type == 5 && item.bargain == 0">详情</navigator>
						<navigator class="buy buybtnbtn buybtn-1" style :url="'../../../bargain/detail/detail?id=' + item.bargain" v-if="item.bargain > 0">详情</navigator>
					</view>
				</view>
			</view>
		</template> -->
		<!-- <loading v-if="!show">加载中...</loading> -->
		<view class="model" v-if="modelShow">
			<view class="inner1">
				<view class="title">用户未授权</view>
				<view class="image"><image :src="imgUrl + 'plugin/app/static/images/wxapp/shouquan.png'"></image></view>
				<view class="subtitle">您需要先开启【用户信息】，才能使用此功能哦~</view>
				<view class="model-btns">
					<view @tap="cancelclick" class="cancel">取消</view>
					<view @tap="confirmclick" class="confirm">去设置</view>
				</view>
			</view>
		</view>
		<view class="page header-sort navbar goodslist">
			<view class="fui-header">
				<view class="searchbar">
					<icon size="18" type="search"></icon>
					<input @confirm="bindSearch" @focus="bindFocus" @input="bindInput" :focus="focusin" name="search" placeholder="输入关键字进行搜索" :value="params.keywords" />
				</view>
				<text @tap="changeMode" :class="'icon icox ' + (listmode == '' ? 'icox-app' : 'icox-viewlist')" v-if="!fromsearch"></text>
				<view @tap="bindback" class="cancel" v-if="fromsearch">取消</view>
			</view>
			<view class="sort">
				<view @tap="bindSort" :class="'item ' + (params.order == '' || !params.order ? 'on' : '')" data-order=""><view class="text">综合</view></view>
				<view @tap="bindSort" :class="'item ' + (params.order == 'sales' ? 'on' : '')" data-order="sales"><view class="text">销量</view></view>
				<view @tap="bindSort" :class="'item item-price ' + (params.order == 'minprice' ? 'on' : '')" data-order="minprice">
					<view class="text">
						价格
						<image class="icon" :src="'/static/images/icon/listsort' + listorder + '.png'"></image>
					</view>
				</view>
				<view @tap="showFilter" :class="'item ' + (isfilter ? 'on' : '')">
					<view class="text">
						筛选
						<image class="icon small" :src="isfilter ? '/static/images/icon-red/filter.png' : '/static/images/icon/filter.png'"></image>
					</view>
				</view>
			</view>
			<view :class="'fui-goods-group ' + listmode">
				<block data-type="template" data-is="tpl_list" data-attr="item:item" v-for="(item, index) in list" :key="index">
					<navigator :url="'../detail/index?id=' + item.id">
						<view class="fui-list">
							<view class="fui-list-media"><image class="round" :src="item.thumb"></image></view>
							<view class="fui-list-inner">
								<view class="row">
									<view class="row-text">{{ item.title }}</view>
								</view>
								<view class="subtitle">{{ item.createtime }}</view>
							</view>
							<view class="fui-list-angle"><view class="angle"></view></view>
						</view>
					</navigator>
				</block>
			</view>
			<view class="fui-loading" v-if="loading">
				<view class="icon"></view>
				<view class="text">正在加载</view>
			</view>
			<view class="fui-loading empty" v-if="list.length == total && total > 0"><view class="text">没有更多了</view></view>
			<view class="fui-loading empty" v-if="total <= 0 && !loading"><view class="text">暂时没有任何商品</view></view>
			<view class="records" v-if="fromsearch">
				<block v-if="searchRecords.length > 0">
					<view class="records-title">
						<view @tap="delRecord" class="pull-right text-danger">清除</view>
						<view>历史搜索</view>
					</view>
					<view class="navs">
						<nav @tap="bindnav" :data-text="item" v-for="(item, index) in searchRecords" :key="index">{{ item }}</nav>
					</view>
				</block>
				<view hidden class="records-title">
					<view class="pull-right text-danger">换一批</view>
					<view>热门搜索</view>
				</view>
				<view hidden class="navs">
					<nav @tap="bindnav" data-text="推子">推子</nav>
					<nav @tap="bindnav" data-text="推子">推子</nav>
					<nav @tap="bindnav" data-text="推子">推子</nav>
				</view>
			</view>

			<!-- <block data-src="/pages/common/goods-picker.wxml">
				<view
					:class="'fui-modal goods-picker ' + slider + ' ' + (minpicker == 'quickbuy' ? 'goodslist' : minpicker) + '  ' + iphonexnavbar"
					v-if="tempname == 'select-picker' && !cycledate"
				>
					<view class="option-picker">
						<view class="option-picker-inner">
							<view class="option-picker-cell goodinfo" v-if="minpicker == 'goodsdetail'">
								<view @tap="emptyActive" class="closebtn"><i class="icox icox-guanbi1" style="font-size:44rpx"></i></view>
								<view class="img"><image class="thumb" :src="goods.thumb" style="width:100%;height:100%;"></image></view>
								<view class="info info-price text-danger">
									<span style="vertical-align: middle;">
										¥
										<span class="price">
											<block v-if="goods.ispresell > 0 && (goods.preselltimeend == 0 || goods.preselltimeend > goods.thistime)">
												{{ goods.presellprice }}
											</block>
											<block v-else-if="goods.isdiscount != 0 && goods.isdiscount_time >= now">{{ goods.minprice }}</block>
											<block v-else>
												<block v-if="goods.maxprice == goods.minprice">{{ goods.marketprice }}</block>
												<block v-else>{{ goods.minprice }}~{{ goods.maxprice }}</block>
											</block>
										</span>
									</span>
									<text class="cycle-tip" style="margin-left: 10rpx;position: reletive;top:-20rpx;" v-if="goods.type == 9">周期购</text>
									<view
										:class="'option-Commission ' + (optionCommission ? 'show' : '')"
										v-if="goods.cansee > 0 && goods.seecommission > 0 && (!goods.seckillinfo || (goods.seckillinfo && goods.seckillinfo.status == 1))"
									>
										{{ goods.seetitle }}￥{{ goods.seecommission }}
									</view>
								</view>
								<view class="info info-total">
									<block v-if="!goods.seckillinfo || (goods.seckillinfo && goods.seckillinfo.status == 1)">
										<block v-if="goods.member_discount > 0">
											<text class="total text-danger" style="color:#c8952a">¥ {{ goods.member_discount }}</text>
											<view class="member-price">
												会员价
												<text></text>
											</view>
										</block>
										<block v-if="goods.showtotal == 1">
											库存
											<text class="total text-danger">{{ goods.total }}</text>
											件
										</block>
									</block>
								</view>
								<view class="info info-titles">
									<block v-if="pickerOption.specs.length > 0">{{ specsTitle == '' ? '请选择规格' : '已选 ' + specsTitle }}</block>
								</view>
							</view>
							<view class="fui-list" v-else>
								<view class="fui-list-media"><image class="thumb" :src="goods.thumb"></image></view>
								<view class="fui-list-inner">
									<view class="subtitle">{{ goods.title }}</view>
									<view class="price">
										<span>
											¥
											<span class="price">
												<block v-if="goods.ispresell > 0 && (goods.preselltimeend == 0 || goods.preselltimeend > goods.thistime)">
													<text v-if="goods.hasoption == 1 && goods.maxprice != goods.minprice">{{ goods.minprice }}~{{ goods.maxprice }}</text>
													<text v-else>{{ goods.presellprice }}</text>
												</block>
												<block v-else>
													<block v-if="goods.maxprice == goods.minprice">{{ goods.marketprice }}</block>
													<block v-else>{{ goods.minprice }}~{{ goods.maxprice }}</block>
												</block>
											</span>
										</span>
									</view>
								</view>
							</view>
							<view class="option-picker-options">
								<view class="option-picker-cell option spec" v-for="(spec, idx) in pickerOption.specs" :key="idx">
									<view class="title">{{ spec.title }}</view>
									<view class="select">
										<a
											@tap="specsTap"
											:class="'btn btn-default btn-sm nav spec-item ' + (specsData[idx].id == item.id ? 'btn-danger' : '')"
											:data-id="item.id"
											:data-idx="idx"
											:data-thumb="item.thumb"
											:data-title="item.title"
											href="javascript:;"
											v-for="(item, spec_item_key) in spec.items"
											:key="spec_item_key"
										>
											{{ item.title }}
										</a>
									</view>
								</view>
								<view class="option-picker-cell option" v-if="goods.type == 9">
									<view class="title">预计送达时间</view>
									<view style="font-size:24rpx;color:#999;">买家需要提前{{ goods.ahead_goods }}天下单，才能在最近的配送周期送达</view>
									<view class="select">
										<a
											@tap="specsTap"
											class="btn btn-default btn-sm nav spec-item btn-danger"
											data-id
											:data-idx="idx"
											data-thumb
											data-title
											href="javascript:;"
										>
											{{ currentDate }}
										</a>
										<text @tap="editdate" class="btn-sm nav spec-item" style="line-height: 52rpx;color: #ff5555;">修改</text>
									</view>
								</view>
								<block data-src="/pages/common/diyform.wxml">
									<view class="fui-cell-group diyform-container" style="margin-top:0px" v-if="diyform.fields != null && diyform.fields.length > 0">
										<block v-for="(field, key1) in diyform.fields" :key="key1">
											<view :class="'fui-cell ' + (field.tp_must ? 'must' : '')">
												<view class="fui-cell-info" v-if="field.data_type == 13">{{ field.tp_name }}</view>
												<view class="fui-cell-label" v-if="field.data_type != 13">{{ field.tp_name }}</view>
												<view class="fui-cell-info wrap" v-if="field.data_type != 13">
													<input
														@input="DiyFormHandler"
														class="fui-input"
														:data-field="field.diy_type"
														data-type="input"
														:placeholder="field.placeholder"
														:value="diyform.f_data[field.diy_type]"
														v-if="field.data_type == 0"
													/>
													<scroll-view @tap="showtextarea" :data-index="index" :data-text="text" v-if="field.data_type == 1 && !field.texthide">
														<view class="placeholder" :style="field.black">{{ field.placeholder }}</view>
													</scroll-view>
													<textarea
														@blur="bindTextAreaBlur"
														@input="DiyFormHandler"
														:data-field="field.diy_type"
														:data-index="index"
														data-type="textarea"
														:placeholder="field.placeholder"
														:value="diyform.f_data[field.diy_type]"
														v-if="field.textareashow"
													></textarea>
													<picker
														@change="DiyFormHandler"
														:data-field="field.diy_type"
														data-type="picker"
														:range="field.tp_text"
														:value="diyform.f_data[field.diy_type][0]"
														v-if="field.data_type == 2"
													>
														<view>{{ diyform.f_data[field.diy_type][1] }}</view>
													</picker>
													<checkbox-group @change="DiyFormHandler" :data-field="field.diy_type" data-type="checkbox" v-if="field.data_type == 3">
														<label class="checkbox-label" v-for="(item, key2) in field.tp_text" :key="key2">
															<checkbox
																:checked="diyform.f_data[field.diy_type][item]"
																class="zoom-80 align-middle"
																color="#ff5555"
																:name="item"
																:value="item"
															></checkbox>
															<text class="align-middle">{{ item }}</text>
														</label>
													</checkbox-group>
													<view v-if="field.data_type == 5">
														<view class="fui-images fui-images-sm">
															<image
																@tap="DiyFormHandler"
																class="image image-sm"
																:data-field="field.diy_type"
																data-type="image-preview"
																:src="item.url"
																v-for="(item, key3) in diyform.f_data[field.diy_type].images"
																:key="key3"
															>
																<span
																	@tap="DiyFormHandler"
																	class="image-remove"
																	:data-field="field.diy_type"
																	:data-filename="item.filename"
																	data-type="image-remove"
																>
																	<text class="icox icox-close"></text>
																</span>
															</image>
														</view>
														<view
															@tap="DiyFormHandler"
															class="fui-uploader fui-uploader-sm"
															:data-field="field.diy_type"
															data-type="image"
															v-if="diyform.f_data[field.diy_type].count < field.tp_max"
														></view>
													</view>
													<input
														@input="DiyFormHandler"
														:data-field="field.diy_type"
														data-type="input"
														placeholder="请输入身份证号码"
														type="idcard"
														:value="diyform.f_data[field.diy_type]"
														v-if="field.data_type == 6"
													/>
													<picker
														@change="DiyFormHandler"
														:data-field="field.diy_type"
														data-type="date"
														mode="date"
														:value="diyform.f_data[field.diy_type]"
														v-if="field.data_type == 7"
													>
														<view>{{ diyform.f_data[field.diy_type] || '请选择' + field.tp_name }}</view>
													</picker>
													<view class="picker-group" v-if="field.data_type == 8">
														<view class="diyform-pulldown2">
															<picker
																@change="DiyFormHandler"
																:data-field="field.diy_type"
																data-type="datestart"
																mode="date"
																:value="diyform.f_data[field.diy_type][0]"
															>
																<view>{{ diyform.f_data[field.diy_type][0] || '开始日期' }}</view>
															</picker>
														</view>
														<view style="float: left;display: inline-block;margin: 0 .5rem;color: #000;">至</view>
														<view class="diyform-pulldown2">
															<picker
																@change="DiyFormHandler"
																:data-field="field.diy_type"
																data-type="dateend"
																mode="date"
																:value="diyform.f_data[field.diy_type][1]"
															>
																<view>{{ diyform.f_data[field.diy_type][1] || '结束日期' }}</view>
															</picker>
														</view>
													</view>
													<view
														@tap="selectArea"
														:data-area="
															diyform.f_data[field.diy_type].province +
																' ' +
																diyform.f_data[field.diy_type].city +
																' ' +
																diyform.f_data[field.diy_type].area
														"
														:data-field="field.diy_type"
														:data-hasarea="field.tp_area"
														data-type="city"
														v-if="field.data_type == 9"
													>
														<text v-if="!diyform.f_data[field.diy_type].province || !diyform.f_data[field.diy_type].city">
															请选择{{ field.tp_name }}
														</text>
														<text v-else>
															{{ diyform.f_data[field.diy_type].province + ' ' + diyform.f_data[field.diy_type].city }}
															{{ field.tp_area == 1 ? diyform.f_data[field.diy_type].area : '' }}
														</text>
													</view>
													<view v-if="field.data_type == 10">
														<input
															@input="DiyFormHandler"
															class="fui-input"
															data-datatype="10"
															:data-field="field.diy_type"
															data-name="name1"
															data-type="input"
															:placeholder="field.tp_name"
															:value="diyform.f_data[field.diy_type].name1"
														/>
													</view>
													<picker
														@change="DiyFormHandler"
														:data-field="field.diy_type"
														data-type="time"
														mode="time"
														:value="diyform.f_data[field.diy_type]"
														v-if="field.data_type == 11"
													>
														<view>{{ diyform.f_data[field.diy_type] || '请选择' + field.tp_name }}</view>
													</picker>
													<view class="picker-group" v-if="field.data_type == 12">
														<picker
															@change="DiyFormHandler"
															:data-field="field.diy_type"
															data-type="timestart"
															mode="time"
															:value="diyform.f_data[field.diy_type][0]"
														>
															<view>{{ diyform.f_data[field.diy_type][0] || '请选择' + field.tp_name[0] }}</view>
														</picker>
														<picker
															@change="DiyFormHandler"
															:data-field="field.diy_type"
															data-type="timeend"
															mode="time"
															:value="diyform.f_data[field.diy_type][0]"
														>
															<view>{{ diyform.f_data[field.diy_type][1] || '请选择' + field.tp_name[1] }}</view>
														</picker>
													</view>
													<radio-group @change="DiyFormHandler" :data-field="field.diy_type" data-type="radio" v-if="field.data_type == 14">
														<label class="radiolabel" v-for="(item, key4) in field.tp_text" :key="key4">
															<radio
																:checked="diyform.f_data[field.diy_type] == item"
																class="align-middle"
																color="#ff5555"
																:name="item"
																:value="item"
															></radio>
															<text class="align-middle">{{ item }}</text>
														</label>
													</radio-group>
												</view>
											</view>
											<view :class="'fui-cell ' + (field.tp_must ? 'must' : '')" v-if="field.data_type == 10">
												<view class="fui-cell-label">{{ field.tp_name2 }}</view>
												<view class="fui-cell-info">
													<input
														@input="DiyFormHandler"
														class="fui-input"
														data-datatype="10"
														:data-field="field.diy_type"
														data-name="name2"
														data-type="input"
														:placeholder="field.tp_name2"
														:value="diyform.f_data[field.diy_type].name2"
													/>
												</view>
											</view>
										</block>
									</view>
								</block>
								<view class="fui-cell-group nomargin" v-if="goods.type != 9 && (!goods.seckillinfo || (seckillinfo && seckillinfo.status == 1))">
									<view class="fui-cell">
										<view class="fui-cell-label">数量</view>
										<view class="fui-cell-info"></view>
										<view class="fui-cell-mask noremark">
											<view @tap="number" class="fui-number" :data-id="goods.id" :data-max="goods.maxbuy" :data-min="goods.minbuy" :data-value="total">
												<view :class="'minus ' + (total * 1 <= goods.minbuy * 1 || total <= 1 ? 'disabled' : '')" data-action="minus">-</view>
												<input @blur="inputNumber" class="num" name type="number" :value="total" />
												<view :class="'plus ' + (total * 1 >= goods.maxbuy * 1 && goods.maxbuy != 0 ? 'disabled' : '')" data-action="plus">+</view>
											</view>
										</view>
									</view>
								</view>
								<view class="fui-cell-group fui-sale-group" v-if="goods.giftinfo">
									<view class="fui-cell">
										<view class="fui-cell-label" style="color:#000;width:98rpx">赠品</view>
										<radio-group>
											<view
												@tap="chooseGift"
												class="gift-list flex"
												:data-id="item.id"
												style="align-items: center;border-top: 1px solid #eee"
												v-for="(item, gift_key1) in goods.giftinfo"
												:key="gift_key1"
											>
												<view class="radio">
													<radio
														:checked="giftid == item.id ? 'checked' : ''"
														class="fui-radio fui-radio-danger"
														color="#ff5555"
														:data-id="item.id"
														value="1"
													></radio>
												</view>
												<view class="flex1">
													<view class="fui-list" style="background: #fff;" v-for="(item, gift_key2) in item.gift" :key="gift_key2">
														<view class="flex gift-goods-group">
															<image :src="item.thumb"></image>
															<view class="gift-title">{{ item.title }}</view>
															<view class="subtitle">￥{{ item.marketprice }}</view>
														</view>
													</view>
												</view>
											</view>
										</radio-group>
									</view>
								</view>
							</view>
						</view>
						<view :class="'fui-navbar ' + iphonexnavbar">
							<block v-if="pagepicker == 'quickbuy'">
								<a @tap="getCart" class="nav-item btn cartbtn" href v-if="modeltakeout != 'cantaddcart'">加入购物车</a>
								<a @tap="buyNow" class="nav-item btn buybtn" data-type="goods_detail" href v-if="modeltakeout == 'shopmodel' || modeltakeout == 'cantaddcart'">
									立刻购买
								</a>
							</block>
							<block v-if="pagepicker == 'goodslist'">
								<a @tap="getCart" class="nav-item btn cartbtn" href v-if="!goods.giftinfo && goods.canAddCart == 1">加入购物车</a>
								<a @tap="buyNow" class="nav-item btn buybtn" data-type="goods_detail" href>立刻购买</a>
							</block>
							<view v-if="canBuy==''&&buyType=='cart'&&pagepicker!='goodslist'&&pagepicker!='quickbuy'" @tap="getCart" :class="'nav-item btn confirmbtn ' + (canBuy!=''?'disabled':'')" :data-hasoption="goods.hasoption" :data-id="goods.id" :data-optionid="optionid" :data-total="total">{{canBuy==''?'确定':'库存不足'}}</view>
							<view v-if="canBuy==''&&buyType=='buy'&&pagepicker!='goodslist'&&pagepicker!='quickbuy'" @tap="buyNow" :class="'nav-item btn confirmbtn ' + (canBuy!=''?'disabled':'')" :data-hasoption="goods.hasoption" :data-id="goods.id" :data-optionid="optionid" :data-total="total">{{canBuy==''?'确定':'库存不足'}}</view>
							<view v-if="canBuy==''&&buyType=='select'&&pagepicker!='goodslist'&&pagepicker!='quickbuy'" @tap="select" :class="'nav-item btn confirmbtn ' + (canBuy!=''?'disabled':'')" :data-hasoption="goods.hasoption" :data-id="goods.id" :data-optionid="optionid" :data-total="total">{{canBuy==''?'确定':'库存不足'}}</view>
						</view>
						<view
							@tap="emptyActive"
							class="icox icox-guanbi-copy"
							style="color:#fff;text-align:center;font-size:60rpx;margin-top:30rpx;"
							v-if="pagepicker == 'goodslist' || pagepicker == 'quickbuy'"
						></view>
					</view>
				</view>
			</block> -->
			<uni-menu :route="route" :icons="icons" :cartcount="cartcount"></uni-menu>
			<!-- <city-picker></city-picker> -->
			<view :class="'screen ' + (isFilterShow ? 'in' : '')">
				<view class="attribute">
					<view class="item on">
						<view @tap="btnFilterBtns" :class="'btn btn-default-o block ' + (filterBtns.isrecommand ? 'btn-danger-o' : '')" data-type="isrecommand">
							<icon color="#fd5454" size="12" type="success_no_circle" v-if="filterBtns.isrecommand"></icon>
							推荐商品
						</view>
					</view>
					<view class="item">
						<view @tap="btnFilterBtns" :class="'btn btn-default-o block ' + (filterBtns.isnew ? 'btn-danger-o' : '')" data-type="isnew">
							<icon color="#fd5454" size="12" type="success_no_circle" v-if="filterBtns.isnew"></icon>
							新品上市
						</view>
					</view>
					<view class="item">
						<view @tap="btnFilterBtns" :class="'btn btn-default-o block ' + (filterBtns.ishot ? 'btn-danger-o' : '')" data-type="ishot">
							<icon color="#fd5454" size="12" type="success_no_circle" v-if="filterBtns.ishot"></icon>
							热卖商品
						</view>
					</view>
					<view class="item">
						<view @tap="btnFilterBtns" :class="'btn btn-default-o block ' + (filterBtns.isdiscount ? 'btn-danger-o' : '')" data-type="isdiscount">
							<icon color="#fd5454" size="12" type="success_no_circle" v-if="filterBtns.isdiscount"></icon>
							促销商品
						</view>
					</view>
					<view class="item">
						<view @tap="btnFilterBtns" :class="'btn btn-default-o block ' + (filterBtns.issendfree ? 'btn-danger-o' : '')" data-type="issendfree">
							<icon color="#fd5454" size="12" type="success_no_circle" v-if="filterBtns.issendfree"></icon>
							卖家包邮
						</view>
					</view>
					<view class="item">
						<view @tap="btnFilterBtns" :class="'btn btn-default-o block ' + (filterBtns.istime ? 'btn-danger-o' : '')" data-type="istime">
							<icon color="#fd5454" size="12" type="success_no_circle" v-if="filterBtns.istime"></icon>
							限时抢购
						</view>
					</view>
				</view>
				<block v-if="catlevel != -1 && opencategory">
					<view class="title">选择分类</view>
					<view class="cate" data-catlevel="{$catlevel}">
						<view class="item">
							<view v-for="(item, index) in category_parent" :key="index">
								<nav @tap="bindCategoryEvents" :class="category_parent_selected == item.id ? 'on' : ''" :data-id="item.id" data-level="1">{{ item.name }}</nav>
							</view>
						</view>
						<view class="item" v-if="catlevel >= 2">
							<view v-for="(item, index) in category_child" :key="index">
								<nav @tap="bindCategoryEvents" :class="category_child_selected == item.id ? 'on' : ''" :data-id="item.id" data-level="2">{{ item.name }}</nav>
							</view>
						</view>
						<view class="item" v-if="catlevel >= 3">
							<view v-for="(item, index) in category_third" :key="index">
								<nav @tap="bindCategoryEvents" :class="category_third_selected == item.id ? 'on' : ''" :data-id="item.id" data-level="3">{{ item.name }}</nav>
							</view>
						</view>
					</view>
				</block>
				<view class="btns">
					<view @tap="bindFilterCancel" class="cancel">取消筛选</view>
					<view @tap="bindFilterSubmit" class="confirm">确认</view>
				</view>
			</view>
		</view>
		<!-- <view :class="'fui-toast ' + (FoxUIToast.show?'in':'out')">
    <view class="text">{{FoxUIToast.text}}</view>
</view> -->
		<view @tap="emptyActive" class="nav-mask" :style="active ? 'display:block' : ''"></view>
		<view @tap="showFilter" :class="'fui-mask ' + (isFilterShow ? 'show' : 'hide')"></view>
	</view>
</template>

<script>
var t = getApp().globalData,
	e = t.requirejs('core'),
	a = t.requirejs('jquery'),
	s = t.requirejs('biz/diyform'),
	i = t.requirejs('biz/goodspicker');
t.requirejs('foxui');

import citypicker from '@/pages/common/city-picker';
import uniMenu from '@/pages/common/menu';

export default {
	data() {
		return {
			goods: {},
			specs: [],
			options: [],
			diyform: {},
			specsTitle: '',
			total: 1,
			active: '',
			slider: '',
			buyType: '',
			icons: t.requirejs('icons'),
			isFilterShow: !1,
			listmode: 'block',
			listsort: '',
			page: 1,
			loaded: !1,
			loading: !0,
			allcategory: [],
			catlevel: -1,
			opencategory: !1,
			category: {},
			category_child: [],
			category_third: [],
			filterBtns: {
				isdiscount: 0,
				ishot: 0,
				isnew: 0,
				isrecommand: 0,
				issendfree: 0,
				istime: 0
			},
			isfilter: 0,
			list: [],
			params: {},
			count: 0,
			defaults: {
				keywords: '',
				isrecommand: '',
				ishot: '',
				isnew: '',
				isdiscount: '',
				issendfree: '',
				istime: '',
				cate: '',
				order: '',
				by: 'desc',
				merchid: 0
			},
			lastcat: '',
			fromsearch: !1,
			searchRecords: [],
			areas: [],
			limits: !0,
			modelShow: !1,
			canload: !0,
			imgUrl: '',
			category_parent: '',
			show: '',
			listorder: '',
			sort_selected: '',
			cateogry_parent_selected: '',
			category_child_selected: '',
			category_third_selected: '',
			category_parent_selected: '',
			focusin: '',
			item: {},
			cartcount: 0,
			showPicker: !0,
			iphonexnavbar: !1,
			noArea: !0,
			pval: [1, 2, 3],
			id:2,
			tempname:'group-picker',
			
		};
	},
	components: { citypicker, uniMenu },
	props: {},
	onLoad: function(e) {
		var s = this;

		if (
			(s.setData({
				imgUrl: t.globalData.approot
			}),
			setTimeout(function() {
				s.setData({
					areas: t.getCache('cacheset').areas
				});
			}, 3e3),
			!a.isEmptyObject(e))
		) {
			var i = e.isrecommand || e.isnew || e.ishot || e.isdiscount || e.issendfree || e.istime ? 1 : 0;
			this.setData({
				params: e,
				isfilter: i,
				filterBtns: e,
				fromsearch: e.fromsearch || !1
			});
		}
		this.initCategory(), e.fromsearch || this.getList(), this.getRecord();
	},
	onShow: function() {
		//this.fromsearch && this.setFocus();
		var t = this;
		// #ifdef MP-WEIXIN
		wx.getSetting({
			success: function(e) {
				var a = e.authSetting['scope.userInfo'];
				t.setData({
					limits: a
				});
			}
		});
		// #endif
	},
	onReachBottom: function() {
		this.loaded || this.list.length == this.total || (1 == this.canload && this.getList());
	},
	methods: {
		initCategory: function() {
			var t = this;
			e.get('goods/get_category', {}, function(e) {
				t.setData({
					allcategory: e.allcategory,
					category_parent: e.allcategory.parent,
					category_child: [],
					category_third: [],
					catlevel: e.catlevel,
					opencategory: e.opencategory,
					show: !0
				});
			});
		},
		getList: function() {
			var t = this;
			let post = {};
			Object.keys(this.params).map(item => {
				if (this.params[item] == 'showFilter') post[item] = '';
				else post[item] = this.params[item];
			});

			t.setData({
				loading: !0
			}),
				(this.canload = !1),
				(getApp().globalData.params.page = getApp().globalData.page),
				e.get('goods/get_list', post, function(e) {
					var a = {
						loading: !1,
						count: e.total,
						show: !0
					};
					e.list || (e.list = []),
						e.list.length > 0 &&
							((a.page = getApp().globalData.page + 1), (a.list = getApp().globalData.list.concat(e.list)), e.list.length < e.pagesize && (a.loaded = !0)),
						t.setData(a),
						(getApp().globalData.canload = !0);
				});
		},
		changeMode: function() {
			'block' == this.listmode
				? this.setData({
						listmode: ''
				  })
				: this.setData({
						listmode: 'block'
				  });
		},
		bindSort: function(t) {
			var e = t.currentTarget.dataset.order,
				a = this.params;
			this.isfilter = '';
			if ('' == e) {
				if (a.order == e) return;
				(a.order = ''),
					this.setData({
						listorder: ''
					});
			} else if ('minprice' == e)
				this.setData({
					listorder: ''
				}),
					a.order == e ? ('desc' == a.by ? (a.by = 'asc') : (a.by = 'desc')) : (a.by = 'asc'),
					(a.order = e),
					this.setData({
						listorder: a.by
					});
			else if ('sales' == e) {
				if (a.order == e) return;
				this.setData({
					listorder: ''
				}),
					(a.order = 'sales'),
					(a.by = 'desc');
			}

			a.ishot = 0;
			a.isnew = 0;
			a.isrecommand = 0;
			a.issendfree = 0;
			a.istime = 0;
			a.isdiscount = 0;
			a.cate = '';
			this.setData({
				params: a,
				page: 1,
				list: [],
				loading: !0,
				loaded: !1,
				sort_selected: e,
				isFilterShow: false,
				filterBtns: {
					ishot: 0,
					isnew: 0,
					isrecommand: 0,
					issendfree: 0,
					istime: 0,
					isdiscount: 0
				}
			}),
				this.getList();
		},
		showFilter: function() {
			this.setData({
				isfilter: 'on',
				'params.order': 'showFilter',
				isFilterShow: !this.isFilterShow
			});
		},
		btnFilterBtns: function(t) {
			var e = t.target.dataset.type;

			if (e) {
				var s = this.filterBtns;
				s.hasOwnProperty(e) || (s[e] = ''), s[e] ? (s[e] = 0) : (s[e] = 1);
				var i = a.isEmptyObject(s) ? 0 : 1;
				this.setData({
					filterBtns: s,
					isfilter: i
				});
			}
		},
		bindFilterCancel: function() {
			this.defaults.cate = '';
			var t = this.defaults;
			this.setData({
				page: 1,
				params: t,
				isFilterShow: !1,
				lastcat: '',
				cateogry_parent_selected: '',
				category_child_selected: '',
				category_third_selected: '',
				category_child: [],
				category_third: [],
				filterBtns: {
					isdiscount: 0,
					ishot: 0,
					isnew: 0,
					isrecommand: 0,
					issendfree: 0,
					istime: 0
				},
				loading: !0,
				loaded: !1,
				listorder: '',
				list: [],
				params: {
					order: ''
				},
				isfilter: ''
			}),
				this.getList();
		},

		bindFilterSubmit: function() {
			var t = this.params,
				e = this.filterBtns;
			for (var s in e) t[s] = e[s];

			a.isEmptyObject(e) && (t = this.defaults),
				(t.cate = this.lastcat),
				this.setData({
					page: 1,
					params: t,
					isFilterShow: !1,
					filterBtns: e,
					list: [],
					loading: !0,
					loaded: !1
				}),
				this.getList();
		},
		bindCategoryEvents: function(t) {
			let e;
			//#ifdef H5
			e = t.currentTarget.dataset;
			//#endif
			//#ifdef MP-WEIXIN
			e = t.target.dataset;
			//#endif
			let es = e.id;
			this.setData({
				lastcat: es
			});
			var a = e.level;
			1 == a
				? (this.setData({
						category_child: [],
						category_third: []
				  }),
				  this.setData({
						category_parent_selected: es,
						category_child: this.allcategory.children[es]
				  }))
				: 2 == a
				? (this.setData({
						category_third: []
				  }),
				  this.setData({
						category_child_selected: es,
						category_third: this.allcategory.children[es]
				  }))
				: this.setData({
						category_third_selected: es
				  });
		},
		bindSearch: function(t) {
			t.target;
			this.setData({
				list: [],
				loading: !0,
				loaded: !1
			});
			var e = a.trim(t.detail.value),
				s = this.defaults;
			'' != e
				? ((s.keywords = e),
				  this.setData({
						page: 1,
						params: s,
						fromsearch: !1
				  }),
				  this.getList(),
				  this.setRecord(e))
				: ((s.keywords = ''),
				  this.setData({
						page: 1,
						params: s,
						listorder: '',
						fromsearch: !1
				  }),
				  this.getList());
		},
		bindInput: function(t) {
			var e = a.trim(t.detail.value),
				s = this.defaults;
			s.keywords = '';
			s.order = this.params.order;
			s.by = this.params.by;
			'' == e &&
				(this.setData({
					page: 1,
					list: [],
					loading: !0,
					loaded: !1,
					params: s,
					listorder: s.by,
					fromsearch: !0
				}),
				this.getRecord());
		},
		bindFocus: function(t) {
			'' == a.trim(t.detail.value) &&
				this.setData({
					fromsearch: !0
				});
		},
		bindback: function() {
			wx.navigateBack();
		},
		bindnav: function(t) {
			var e = a.trim(t.currentTarget.dataset.text),
				s = this.defaults;
			(s.keywords = e),
				this.setData({
					params: s,
					page: 1,
					fromsearch: !1
				}),
				this.getList(),
				this.setRecord(e);
		},
		getRecord: function() {
			var e = t.getCache('searchRecords');
			this.setData({
				searchRecords: e
			});
		},
		setRecord: function(e) {
			if ('' != e) {
				var s = t.getCache('searchRecords');

				if (a.isArray(s)) {
					var i = [];

					for (var r in (i.push(e), s)) {
						if (i.length > 20) break;
						s[r] != e && null != s && 'null' != s && i.push(s[r]);
					}

					s = i;
				} else (s = []).push(e);

				t.setCache('searchRecords', s);
			} else t.setCache('searchRecords', []);

			this.getRecord();
		},
		delRecord: function() {
			this.setRecord(''),
				this.setData({
					fromsearch: !0
				});
		},
		setFocus: function() {
			var t = this;
			setTimeout(function() {
				t.setData({
					focusin: !0
				});
			}, 1e3);
		},
		selectPicker: function(e) {
			t.checkAuth();
			var a = this;
			wx.getSetting({
				success: function(t) {
					if (t.authSetting['scope.userInfo']) {
						i.selectpicker(e, a, 'goodslist');
					}
				}
			});
		},
		specsTap: function(t) {
			i.specsTap(t, this);
		},
		chooseGift: function(t) {
			i.chooseGift(t, this);
		},
		emptyActive: function() {
			this.setData({
				active: '',
				slider: 'out',
				tempname: '',
				specsTitle: ''
			});
		},
		buyNow: function(t) {
			i.buyNow(t, this);
		},
		getCart: function(t) {
			i.getCart(t, this);
		},
		select: function() {
			i.select(this);
		},
		inputNumber: function(t) {
			i.inputNumber(t, this);
		},
		number: function(t) {
			i.number(t, this);
		},
		onChange: function(t) {
			return s.onChange(this, t);
		},
		DiyFormHandler: function(t) {
			return s.DiyFormHandler(this, t);
		},
		selectArea: function(t) {
			return s.selectArea(this, t);
		},
		bindChange: function(t) {
			return s.bindChange(this, t);
		},
		onCancel: function(t) {
			return s.onCancel(this, t);
		},
		onConfirm: function(t) {
			return s.onConfirm(this, t);
		},
		getIndex: function(t, e) {
			return s.getIndex(t, e);
		},
		cancelclick: function() {
			this.setData({
				modelShow: !1
			});
		},
		confirmclick: function() {
			this.setData({
				modelShow: !1
			}),
				wx.openSetting({
					success: function(t) {}
				});
		}
	}
};
</script>
<style>
@import './index.css';
</style>
